package com.itxzh.logindemo.service.impl;

import com.itxzh.logindemo.entities.Users;
import com.itxzh.logindemo.mapper.UsersMapper;
import com.itxzh.logindemo.service.UsersService;
import com.itxzh.logindemo.utils.TokenRedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Description
 *
 * @Author ldt
 * @Date 2022/5/20 14:39
 * @Version 1.0.0
 */
@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    UsersMapper usersMapper;

    public Users login(Users user) {

        Users user0 = usersMapper.login(user);

        if(user0 == null) {
            throw new RuntimeException("用户名或密码错误！");
        }

        return user0;
    }

    @Override
    public List<Users> getList(Users users) {
        return usersMapper.getList(users);
    }
}
